package com.qzdsoft.erpcloud.service.basic.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.qzdsoft.erpcloud.domain.basic.BusinessType;
import com.qzdsoft.erpcloud.mapper.basic.BusinessTypeMapper;
import com.qzdsoft.erpcloud.service.basic.BusinessTypeService;
import com.qzdsoft.vo.Response;

/**
 * Created by Admin
 */
@Service
public class BasicBusinessTypeServiceImpl implements BusinessTypeService {

    @Autowired
    private BusinessTypeMapper basicBusinessTypeMapper;

    @Override
    public BusinessType selectById(Integer id) {
        return basicBusinessTypeMapper.selectByPrimaryKey(id);
    }

    @Override
    public Response saveOrUpd(BusinessType basicBusinessType) {
        if(null != basicBusinessType.getId()){
            basicBusinessTypeMapper.updateByPrimaryKey(basicBusinessType);
        } else {
            basicBusinessTypeMapper.insert(basicBusinessType);
        }
        return Response.success(null);
    }

    @Override
    public Response del(Integer id) {
        basicBusinessTypeMapper.deleteByPrimaryKey(id);
        return Response.success(null);
    }

    @Override
    public Integer selectDataCount(String name, Integer companyId, Integer isPreinstall) {
        return basicBusinessTypeMapper.selectDataCount(name, companyId, isPreinstall);
    }

    @Override
    public List<BusinessType> selectData(String name, Integer companyId, Integer isPreinstall, Integer start, Integer pageSize) {
        return basicBusinessTypeMapper.selectData(name, companyId, isPreinstall, start, pageSize);
    }
}
